The Strasbourg-based Grand Chamber, effectively the court of last appeal, confirmed an earlier ruling against Leyla Sahin, saying Turkey's notion of secularism was consistent with the values underpinning the European Convention on Human Rights.
The decision marked the end of a protracted legal battle at the European court by Sahin, a student barred from attending Istanbul University medical school in 1998 because her headscarf violated the official dress code.
"There is no possibility of further appeal now," a court spokesman said.
The ruling was a victory for Turkey, an overwhelmingly Muslim society which has imposed a rigidly secular system since the 1920s and faces growing scrutiny about Islam as it seeks membership of the European Union.
Ankara also won recognition for its efforts to safeguard women's rights.
"The court also noted the emphasis placed in the Turkish constitutional system on the protection of the rights of women," the court said in a summary of the ruling.
It also took into consideration the need to protect rights and freedoms and maintain public order in a country where a majority of the population, while professing a strong attachment to women's rights and a secular way of life, adhere to the Islamic faith.
"Imposing limitations on the freedom to wear the headscarf could, therefore, be regarded as meeting a pressing social need by seeking to achieve those two legitimate aims, especially since that religious symbol had taken on political significance in Turkey in recent years," the court said.